﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bulb.Test.CollectionServiceTest
{
    [TestClass]
    public class ToggleTests
        : CollectionServiceTests
    {
        [TestMethod]
        public void TestThanOnChangesStateOfBulbToTrue()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.On(result);

            Assert.AreEqual(true, result.State);
        }

        [TestMethod]
        public void TestThanTwoOnChangesStateOfBulbToTrue()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.On(result);
            MockCollectionService.On(result);

            Assert.AreEqual(true, result.State);
        }

        [TestMethod]
        public void TestThanOffChangesStateOfBulbToFalse()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.Off(result);

            Assert.AreEqual(false, result.State);
        }

        [TestMethod]
        public void TestThanTwoOffChangesStateOfBulbToFalse()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.Off(result);
            MockCollectionService.Off(result);

            Assert.AreEqual(false, result.State);
        }

        [TestMethod]
        public void TestThanOnOffChangesStateOfBulbToFalse()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.On(result);
            MockCollectionService.Off(result);

            Assert.AreEqual(false, result.State);
        }

        [TestMethod]
        public void TestThanOffOnChangesStateOfBulbTotrue()
        {
            var result = MockBulbItemRepository.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.State);

            MockCollectionService.Off(result);
            MockCollectionService.On(result);

            Assert.AreEqual(true, result.State);
        }
    }
}